from random import Random
from MimicryHoneypot import *
from RandomEvolver import *
from BestEvolver import *
from Attacker import *
import matplotlib.pyplot as plt

mimcry_honeypot = MimicryHoneypot()
random_evolver = RandomEvolver(mimcry_honeypot)
attackers1 = AttackerLikeMaxDiff(drop_rate=1,noise_rate=2, max_interest=100,min_insterest=10)

best_honeypot = MimicryHoneypot()
best_evolver  = BestEvolver(best_honeypot)
attackers2 = AttackerLikeMaxDiff(drop_rate=1,noise_rate=2, max_interest=100,min_insterest=10)

attackers3 = AttackerLikeMaxDiff(drop_rate=1,noise_rate=2, max_interest=100,min_insterest=10)

epochs = 100

interests1 = []
interests2 = []
interests3 = []
for i in range(epochs):
    print("current:",mimcry_honeypot.currentState())
    random_evolver.step()
    state = mimcry_honeypot.currentState()
    print("ret:",state)
    interest = attackers1.attack(list(state))
    interests1.append(interest)

    print("current:",best_honeypot.currentState())
    best_evolver.step()
    state = best_honeypot.currentState()
    print("ret:",state)
    interest = attackers2.attack(list(state))
    interests2.append(interest)
    state = [0,0,0,0,0]
    if i > 50:
        state = [1,1,1,1,0]
    interest = attackers3.attack(state)
    interests3.append(interest)




plt.plot(interests1)
plt.plot(interests2)
plt.plot(interests3)
plt.legend(['random','DDQN','static'])
plt.show()



